<template>
	<view class="main">
		<image :src="imgUrl + 'login-bj2.png'" mode="heightFix" class="steerImgBg"></image>
		<view class="content" :style="'padding-top:'+wxH.bottom+'px;'">
			<view class="text">
				<p>找靠谱的人</p>
				<p>做靠谱的事</p>
			</view>
			<div class="logoBox">
				<image :src="imgUrl + 'login-main1.png'" mode="widthFix"></image>
			</div>
			<p class="bottomText bottomText-top"><span>职</span><span>海</span><span>扬</span><span>帆</span></p>
			<p class="bottomText bottomText-bottom">重庆高新区青年和大学生就业集市</p>
			<button class="btn" @click="openPage()" :style="'top:'+wxH.top+'px;'">{{time}}S跳转</button>
		</view>
	</view>

</template>

<script>
	import { accessLogs } from "@/core/web-api/login.js"
	import { mapState } from "vuex";
	export default {
		data() {
			return {
				time: 2,
				token: "",
				t: "",
				wxH: this.$wxHanderInformation
			}
		},
		methods: {
			openPage() {
				clearInterval(this.$data.t);
				if (this.$data.token != '') {
					uni.redirectTo({
						url: "/pages/web/home/home"
					});
				} else {
					uni.redirectTo({
						url: '/pagesroot/login/login'
					})
				}
			},
			setAccessLogs(){
				accessLogs().then(res=>{
					if(res.code==20000){
						console.log("增加访问记录")
					}
				})
			},
		},
		mounted() {
			this.$data.token = this.$store.state.token;
			console.log(this.$store.state.token)
			this.$data.t = setInterval(() => {
				if (this.$data.time == 0) {
					this.openPage();
				};
				this.$data.time = this.$data.time > 0 ? this.$data.time - 1 : 0;
			}, 1000);
		},
		computed:{
			...mapState(['imgUrl'])
		},
		created() {
			console.log(this.$store.imgUrl)
			this.setAccessLogs()
		}
	}
</script>

<style>
	.main {
		width: 100vw;
		height: 100vh;
		overflow: hidden;
	}

	.content {
		width: 100%;
		height: 100%;
		box-sizing: border-box;
		position: relative;
		z-index: 999;
	}

	.steerImgBg {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 73;
	}

	.text {
		width: 100%;
		padding: 90px 70px 0;
		box-sizing: border-box;
		margin: 0 auto;
		font-family: CTBiaoSongSJ;
		/* font-weight: 400; */
		font-size: 60px;
		color: #FFFFFF;
	}

	.text p {
		width: 100%;
		display: block;
		color: rgba(255, 255, 255, 1);
		font-size: 36px;
		text-align: left;
		/* font-weight: bold; */
		font-family: PingFangSC-regular;
	}

	.text p:last-child {
		display: flex;
		justify-content: flex-end;
		box-sizing: border-box;
	}

	.logoBox {
		margin: 10% 0 2%;
		width: 100%;
		padding: 0 69px;
		box-sizing: border-box;
	}

	.logoBox image {
		width: 100%;
	}

	.bottomText {
		width: 100%;
		text-align: center;
		font-family: SourceHanSansSC;
		font-weight: 300;
		font-size: 15px;
		color: #FFFFFF;
	}

	.btn {
		width: 100px;
		height: 40px;
		line-height: 40px;
		background: rgba(0, 0, 0, 0.5);
		border-radius: 20px;
		position: fixed;
		top: 10px;
		color: #eee;
		left: 20px;
	}
	.bottomText-top{
		width: 42%;
		border-bottom: 0.5px solid #fff;
		padding: 0px 30px 8px 30px;
		display: flex;
		justify-content: space-around;
		margin: 0 auto;
		font-size: 20px;
	}
	.bottomText-bottom{
		margin-top: 5px;
	}
</style>